package me.chinaq.fastweb.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.ServletRequestHandledEvent;

/**
 * 监听请求处理完后的操作
 * Created by shaoqi on 7/10/2017.
 */
@Component
public class RequestHandledListener implements ApplicationListener<ServletRequestHandledEvent> {
	private static final Logger LOGGER = LoggerFactory.getLogger(RequestHandledListener.class);

	@Override
	public void onApplicationEvent(ServletRequestHandledEvent event) {
		LOGGER.info("This request take time is {}", event.getProcessingTimeMillis());
	}
}
